using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Evolution.Engine.Interfaces;
using System.Collections.ObjectModel;
using Evolution.Engine.Utilities;

namespace Evolution.Engine.Managers
{
    public class QuestManager : Singleton<QuestManager>
    {
        public void LoadAllQuests(string directory, string filter)
        {
            if (!SeeIfDirectoryExists(directory))
                throw new DirectoryNotFoundException(directory + " could not be found");

            foreach(string file in Directory.GetFiles(directory, filter))
            {
                string fileName = file.Remove(0, GameUtils.ExecutingDirectory.Length);
                ScriptManager.Instance.Get<IQuest>(fileName, "Quest"); // Loads the quest if not already compiled
            }
        }
        private bool SeeIfDirectoryExists(string directory)
        {
            return Directory.Exists(directory);
        }
        public IQuest Get(string name)
        {
            return ScriptManager.Instance.Get<IQuest>(name, "Quest");
        }
    }

    public class QuestCollection : Collection<IQuest> { }
}
